﻿using System;
using Alserve.Ffl;
using Alserve.Ffl.Data;

public partial class ffl_anonymous_webusercontrols_PlayerDetails : System.Web.UI.UserControl
{
    private Int32 _playerId = 0;
    private Boolean _hidePosition = false;
    private Boolean _hideClub = false;

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    public Int32 PlayerId
    {
        get { return _playerId; }
        set 
        { 
            _playerId = value;

            _PlayerView thisPlayerView = new _PlayerView();

            thisPlayerView.Where.PlayerId.Value = _playerId;
            if (thisPlayerView.Query.Load())
            {
                PlayerImage.AlternateText = thisPlayerView.Forename + " " + thisPlayerView.Surname;
                PlayerImage.ImageUrl = FflCommon.ImageLocation(thisPlayerView.EspnPlayerId, thisPlayerView.ClubId);
                PlayerNameLink.Text = PlayerImage.AlternateText;
                PositionLabel.Text = thisPlayerView.PositionName;
                ClubNameHyperlink.Text = thisPlayerView.ClubName;
                ClubNameHyperlink.NavigateUrl = "/ffl/anonymous/club.aspx?Id=" + thisPlayerView.ClubId;
                if (thisPlayerView.s_TotalPoints != "")
                    PointsLabel.Text = thisPlayerView.s_TotalPoints + " pts";
                if (thisPlayerView.s_Started != "")
                    StartedMatchesLabel.Text = thisPlayerView.s_Started;
                if (thisPlayerView.s_PlayedAsSub != "")
                    PlayedAsSubLabel.Text = thisPlayerView.s_PlayedAsSub;
                if (thisPlayerView.s_Goals != "")
                    GoalsLabel.Text = thisPlayerView.s_Goals;
                if (thisPlayerView.s_BonusGoals != "")
                    BonusGoalsLabel.Text = thisPlayerView.s_BonusGoals;
                if (thisPlayerView.s_CleanSheets != "")
                    CleanSheetsLabel.Text = thisPlayerView.s_CleanSheets;
                if (thisPlayerView.s_ConcededOne != "")
                    ConcededOneLabel.Text = thisPlayerView.s_ConcededOne;
                if (thisPlayerView.s_TeamScoredThreePlus != "")
                    TeamScoredThreePlusLabel.Text = thisPlayerView.s_TeamScoredThreePlus;
            }
        }
    }

    public Boolean HidePosition
    {
        get { return _hidePosition; }
        set
        {
            _hidePosition = value;
            PositionLabel.Visible = false;
        }
    }

    public Boolean HideClub
    {
        get { return _hideClub; }
        set
        {
            _hideClub = value;
            ClubNameHyperlink.Visible = false;
        }
    }


}
